﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Smartec.Accounts.Camel.AMS.Model.Entities.DBAuditDetail>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    System Audit
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>System Audit</h2>


<% RouteValueDictionary   tRVD = new RouteValueDictionary();
   tRVD["dateFrom"] = ViewBag.dateFrom;
   tRVD["dateUntil"] = ViewBag.dateUntil;
   tRVD["tableName"] = ViewBag.tableName;
   tRVD["entityId"] = ViewBag.entityId;
   tRVD["userName"] = ViewBag.userName;
   tRVD["dbAction"] = ViewBag.dbAction;
   // ID = o.ID, DBAuditName = o.DBAuditName, RevisionStamp = o.RevisionStamp, TableName = o.TableName, UserName = o.UserName, Action = o.Action, ChangedColumns = o.ChangedColumns, EntityId = o.EntityId });
   %>
   
<%: Html.Telerik().Grid<Smartec.Accounts.Camel.AMS.Model.Entities.DBAuditDetail>()
       .Name("Grid")
       .Columns(columns =>
       {
           //columns.Bound(o => o.ID).Title("#").ClientTemplate("<#= ++index #>").Width(30).Filterable(false).Sortable(false);

           //columns.Bound(o => o.Audit);
           columns.Bound(o => o.Action).ClientTemplate("<img alt='<#= Action == 'I'?'Add': (Action == 'U'?'Edit':'Delete') #>' src='Content/media/images/<#= Action == 'I'?'add.png': (Action == 'U'?'edit.gif':'delete.gif') #>' />").Width(70);
           columns.Bound(o => o.TableName).Width(200);
           columns.Bound(o => o.EntityName).Width(200);
           columns.Bound(o => o.Changes).Encoded(false).Width(500);
           columns.Bound(o => o.MasterEntity).Encoded(false).Width(200);
           columns.Bound(o => o.MasterName).Encoded(false).Width(200);
           columns.Bound(o => o.RevisionStamp).ClientTemplate("<#= $.telerik.formatString('{0:dd-MM-yyyy HH:mm:ss}', RevisionStamp) #>").Encoded(false).Width(200);
           columns.Bound(o => o.UserName).Encoded(false).Width(200);
           //columns.Bound(o => o.Audit).Format("G");
       })
           .DataBinding(dataBinding => dataBinding.Ajax().Select("_index", "SystemAudit", tRVD))
       .Filterable()
       .Sortable()
        .Scrollable(scrolling => scrolling.Height("100%"))
       .Pageable(paging => paging.PageSize(500))
       .Groupable(grouping => grouping.Groups(groups => 
        {
            groups.Add(c => c.Audit);
            //groups.Add(c => c.ContactName);
        }))
%>

</asp:Content>